package com.yundingai.config;

import io.minio.MinioClient;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Author HuangZhengmin
 * @desc MinIO 配置类
 * @Date 2025/7/16 14:41
 * @Version 1.0
 */
@Data
@Configuration
@ConfigurationProperties(prefix = "minio")
public class MinioConfig {
  /**
   * 服务地址
   */
  private String url;

  /**
   * 用户名
   */
  private String accessKey;

  /**
   * 密码
   */
  private String secretKey;

  /**
   * 是否使用https
   */
  private boolean secure;

  /**
   * 存储桶名称
   */
  private String bucketName;

  @Bean
  public MinioClient getMinioClient() {
    return MinioClient.builder().endpoint(url).credentials(accessKey, secretKey).build();
  }
}
